package 分组;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    static int n, k;
    static Map<Integer, Integer> map = new HashMap<>();

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int max = 0;
        n = in.nextInt();
        k = in.nextInt();
        for (int i = 0; i < n; i++) {
            int x = in.nextInt();
            map.put(x, map.getOrDefault(x, 0) + 1);
            max = Math.max(max, map.get(x));
        }
        if(map.size()>k){
            System.out.println(-1);
            return;
        }
        int l = 1, r = max;
        while (l < r) {
            int mid = l + r >> 1;
            if (check(mid)) {
                r = mid;
            } else {
                l = mid + 1;
            }
        }
        System.out.println(l);
    }

    private static boolean check(int y) {
        int res = 0;
        for (Map.Entry<Integer, Integer> en : map.entrySet()) {
            int x = en.getValue();
            res += x / y + (x % y == 0 ? 0 : 1);
            if (res > k) {
                return false;
            }
        }

        return true;
    }
}
